Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(network): close the stream when finishing an inbound session #1214

Merged
merged 1 commit into from
Sep 28, 2023

Conversation

ShahakShama
Copy link
Contributor

@ShahakShama ShahakShama commented Sep 28, 2023

This change is Reviewable

@ShahakShama ShahakShama force-pushed the shahak/network/close_inbound_session branch 3 times, most recently from b1a91cf to 8b796ef Compare September 28, 2023 07:57
Copy link
Contributor

@nagmo-starkware nagmo-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 3 of 3 files at r1, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @dan-starkware and @ShahakShama)


crates/papyrus_network/src/streamed_data_protocol/handler.rs line 116 at r1 (raw file):

        cx: &mut Context<'_>,
    ) -> bool {
        let Poll::Ready(finish_reason) = inbound_session.poll_unpin(cx) else {

I don't see any added value to the short circuit here since it's in an if statement any way.
I suggest to improve readability by defining a variable is_session_alive and return it in the end


crates/papyrus_network/src/streamed_data_protocol/handler.rs line 166 at r1 (raw file):

        // Handle inbound sessions.
        self.id_to_inbound_session.retain(|inbound_session_id, inbound_session| {
            if Self::poll_inbound_session(

same here the short circuiting is confusing to read especially since it's nested function

@ShahakShama ShahakShama force-pushed the shahak/network/close_inbound_session branch 2 times, most recently from a5462b2 to b475703 Compare September 28, 2023 10:48
Copy link
Contributor

@nagmo-starkware nagmo-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 of 2 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @dan-starkware)

@ShahakShama ShahakShama force-pushed the shahak/network/close_inbound_session branch from b475703 to 075ae86 Compare September 28, 2023 11:01
Copy link
Contributor

@nagmo-starkware nagmo-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @dan-starkware)

@ShahakShama ShahakShama merged commit fd8a1d3 into new_streamed_data Sep 28, 2023
17 of 18 checks passed
@ShahakShama ShahakShama deleted the shahak/network/close_inbound_session branch September 28, 2023 11:08
@github-actions github-actions bot locked and limited conversation to collaborators Sep 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants